import { useState, useCallback } from 'react';

export function useToggle(initState: boolean = false) {
	const [ state, setState ] = useState(initState);
	const toggle = useCallback(() => setState((state) => !state), []);
	return [ state, toggle ] as const;
}
